<template>
	<view >
		<view class="order-info">
			<template v-for="items in orderInfo">
				<u-cell :title="items.name">
					<view slot="value" class="">
						<template v-if="items.type == 'text'">
							{{items.value}}
						</template>
						<template v-else-if="items.type == 'img'">
							<image style="width: 150rpx;height: auto;" v-if="items.value!='' && items.value!=null" :src="items.value" mode="widthFix"
								@touchstart="handleImage(items.value)"></image>
								<text v-else>暂无</text>
						</template>
					</view>

				</u-cell>
			</template>
		</view>
	</view>
</template>

<script>
	import {mapGetters} from 'vuex'
	import {setText} from '@/utils/utils.js'
	import OrderDetail from '../components/OrderDetail.vue';
	import {
		getOneOrder,
	} from '@/api';
	export default {
		data() {
			return {
				orderInfo: null,
				order:null
			}
		},
		props:{
			id:{
				type:Number,
				default:0
			}
		},
		// computed:{
		// 	...mapGetters([''])
		// },
		created() {
			this.getOne()
		},
		methods: {
			async getOne() {
				const res = await getOneOrder({
					id: this.id
				})
				this.order = res.data
				console.log(setText)
				let orderInfo = [{
						name: "订单日期",
						type: 'text',
						value: res.data.date
					},
					{
						name: "客户名",
						type: 'text',
						value: res.data.merchantName
					},
					{
						name: "结算状态",
						type: 'text',
						class: {
							'text-yellow': res.data.isSettlement == 2,
							'text-green': res.data.isSettlement == 1
						},
						value: setText[res.data.isSettlement+'']
					},
					{
						name: "签名照片",
						type: 'img',
						value: res.data.sign
					}
				]
				this.orderInfo = orderInfo
				this.$emit('load',res.data.isSettlement)
			},
		}
	}
</script>

<style scoped>
.order-info{
	width: 100%;
	background-color: #fff;
}
::v-deep .u-cell__title-text{
	font-size: 32rpx;
	color: #9e9e9e;
}
::v-deep .u-cell__body{
	font-size: 32rpx;
}

</style>